<template>
	<view class="chat-list">
		<view v-for="(item,index) in curMessageList" :key="index" class="">
			<message-right v-if="item.senderUserID == userInfo.id" :key="index" :item="item"
				:type="JSON.parse(item.extendedData).type"></message-right>

			<message-left v-else :key="index" :item="item" :type="JSON.parse(item.extendedData).type"
				:avatar="conversationObj.userAvatarUrl? conversationObj.userAvatarUrl: 'https://api.xiaozhucaishui.com/assets/img/avatar.png'"
				:name="conversationObj.baseInfo.userName"></message-left>
		</view>
	</view>
</template>

<script>
	import messageLeft from "@/pages/message/components/messageLeft.vue";
	import messageRight from "@/pages/message/components/messageRight.vue";
	export default {
		name: 'chatList',
		components: {
			messageLeft,
			messageRight,
		},
		props: {
			curMessageList: {
				type: Array,
				default: () => {
					return [];
				},
			},
			conversationObj: {
				type: Object,
				default: () => {
					return {};
				},
			},
		},
		data() {
			return {
				userInfo: null,
			};
		},
		watch: {

		},

		mounted() {
			this.userInfo = this.$store.state.userInfo
		},

		methods: {

		}
	};
</script>

<style lang="scss" scoped>
	.chat-list {
		padding: 30rpx 0;
	}
</style>